package spring.mybatis.domain;

import com.me.study.javaCore.enumm.ColorEnum;
import org.apache.ibatis.type.Alias;

import java.util.StringJoiner;

/**
 * A simple bean that holds User info.
 */
@Alias("User")
public class User {

  private Integer id;
  private String name;
  private Integer age;
  private ColorEnum color;

  public User() {
  }

  public User(Integer id, String name, Integer age) {
    this.id = id;
    this.name = name;
    this.age = age;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Integer getAge() {
    return age;
  }

  public void setAge(Integer age) {
    this.age = age;
  }

  public ColorEnum getColor() {
    return color;
  }

  public void setColor(ColorEnum color) {
    this.color = color;
  }

  @Override
  public String toString() {
    return new StringJoiner(", ", User.class.getSimpleName() + "[", "]")
            .add("id='" + id + "'")
            .add("name='" + name + "'")
            .add("age=" + age)
            .add("color=" + color)
            .toString();
  }
}
